package com.pub.paypal.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 配置类，注入PayPal需要的认证信息
 */
/**
 * paypal支付配置
 */
@Component
public class PaypalConfig implements InitializingBean {
    //统一在application.yml配置文件中
    @Value("${paypal.mode}")
    public String mode;

    @Value("${paypal.client.app}")
    public String clientId;

    @Value("${paypal.client.secret}")
    public String clientSecret;

    @Value("${paypal.receiver.email}")
    public String email;

    @Value("${paypal.cancelUrl}")
    public String cancelUrl;

    @Value("${paypal.returnUrl}")
    public String returnUrl;

    public static String MODE ;

    public static String CLIENT_ID;

    public static String CLIENT_SECRET;

    public static String EMAIL;

    public static String CANCEL_URL;

    public static String RETURN_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        MODE = mode;
        CLIENT_ID = clientId;
        CLIENT_SECRET = clientSecret;
        EMAIL = email;
        CANCEL_URL = cancelUrl;
        RETURN_URL = returnUrl;
    }

}